// userSlice.js
import { createSlice, PayloadAction } from '@reduxjs/toolkit';

interface UserState {
    isVip: boolean;
    vipExpirationDate: string | null;
}

const initialState: UserState = {
    isVip: false,
    vipExpirationDate: null,
};

const userSlice = createSlice({
    name: 'user',
    initialState,
    reducers: {
        updateVipStatus(state, action: PayloadAction<{ isVip: boolean; expirationDate: string }>) {
            state.isVip = action.payload.isVip;
            state.vipExpirationDate = action.payload.expirationDate;
        },
    },
});

export const { updateVipStatus } = userSlice.actions;
export default userSlice.reducer;